import type { repUserInfo, repWxUserDtosInfo } from '@/services/login'
import type { addressInfo } from '@/services/user'
import type { cardData } from '@/types/card'
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'

// 定义 Store
export const usAdrStore = defineStore(
  'adr',
  () => {
    // 订单信息
    const profile = ref<addressInfo>()

    const setAdr = (adr:addressInfo) => {
      profile.value =adr
    }

    // 记得 return
    return {
      profile,
      setAdr
    }
  },
  // TODO: 持久化
  {
    // persist: true,
    persist: {
      storage: {
        getItem(key) {
          return uni.getStorageSync(key)
        },
        setItem(key, value) {
          uni.setStorageSync(key, value)
        },
      },
    },
  },
)
